--[[
-- Author:      feilong
-- DateTime:    2018-04-23 17:19:33
-- Description: 日志服务
   g.lua, 在没使用 logger_service 的情况下会用这个
--]]

local skynet = require("skynet")

local Service = class("Logger")

function Service:ctor(name)
    local message_handler = new("logger.handler")
    self:register()
end

function Service:register()
    g.register('start', handler(self, self.onStart))
    g.register('close', handler(self, self.onClose))
end

function Service:onStart()
    local REG = skynet.register_protocol
    REG {
        name = "system",
        id = skynet.PTYPE_SYSTEM,
        pack = skynet.pack,
        unpack = skynet.unpack,
    }
    REG {
        name = "text",
        id = skynet.PTYPE_TEXT,
        pack = skynet.pack,
        unpack = skynet.unpack,
    }
    skynet.dispatch("system", g.dispatch:dispatch()) --
    skynet.dispatch("text", g.dispatch:dispatch()) --


    return "ok"
end

function Service:onClose()
end

return Service

